package lab01;

/**
 * Created by 123 on 2017/9/29.
 */
public class Text05 {
    public static void main(String[] args) {
        int sum1 = 0;//定义变量sum来存储求和的值
        int sum2 = 0;
        int sum3 = 0;

        int i = 1;//定义整形变量i

        for (i = 1; i <= 10; i++) {
            sum1 = sum1 + i;//利用for的方法求和
        }


        i = 1;
        while (i <= 10) {
            sum2 = sum2 + i;
            i++;
            //利用while的方法求和
        }


        i = 1;
        do {
            sum3 = sum3 + i;
            i++;
        } while (i <= 10);//利用do while的方法求和



        System.out.println(sum1 + "\t" + sum2 + "\t" + sum3 + "\t");
    }
}
